using System;
using System.Threading;
using System.Threading.Tasks;
using RTMP.SimpleClient.ValueObject;

namespace RTMP.SimpleClient
{
    /// <summary>
    /// RTMP 客户端接口
    /// </summary>
    public interface IRTMPClient
    {
        /// <summary>
        /// 异步连接到 RTMP 服务器
        /// </summary>
        /// <param name="url">RTMP 服务器 URL</param>
        /// <param name="options">可选的连接选项</param>
        /// <param name="cancellationToken">取消令牌</param>
        /// <returns>连接任务</returns>
        Task ConnectAsync(string url, RTMPConnectOptions? options = null, CancellationToken cancellationToken = default);

        /// <summary>
        /// 异步创建流
        /// </summary>
        /// <param name="cancellationToken">取消令牌</param>
        /// <returns>创建流任务，返回流 ID</returns>
        Task<uint> CreateStreamAsync(CancellationToken cancellationToken = default);

        /// <summary>
        /// 异步播放流
        /// </summary>
        /// <param name="streamId">流 ID</param>
        /// <param name="streamName">流名称</param>
        /// <param name="cancellationToken">取消令牌</param>
        /// <returns>播放任务</returns>
        Task PlayAsync(uint streamId, string streamName, CancellationToken cancellationToken = default);

        /// <summary>
        /// 异步发布流
        /// </summary>
        /// <param name="streamId">流 ID</param>
        /// <param name="streamName">流名称</param>
        /// <param name="cancellationToken">取消令牌</param>
        /// <returns>发布任务</returns>
        Task PublishAsync(uint streamId, string streamName, CancellationToken cancellationToken = default);

        /// <summary>
        /// 异步关闭连接
        /// </summary>
        /// <param name="cancellationToken">取消令牌</param>
        /// <returns>关闭任务</returns>
        Task CloseAsync(CancellationToken cancellationToken = default);
    }
}
